home *** CD-ROM | disk | FTP | other *** search
- Path: news.infoserve.net!usenet
- From: paveltka@unix.infoserve.net (Pavel Tkatchouk)
- Newsgroups: comp.lang.c++
- Subject: Re: Stupid Q: what's wrong?
- Date: Mon, 05 Feb 1996 19:22:03 GMT
- Message-ID: <4f5lu9$s7o@news.infoserve.net>
- References: <4ejerd$r84@news.infoserve.net> <DM1wpD.Lqp@iquest.net>
- NNTP-Posting-Host: unix.infoserve.net
- X-Newsreader: Forte Free Agent v0.55
-
- jeffl@inter-intelli.com (Jeff Lindholm) wrote:
-
- >char c;
- >c = *ptr;
- >strcat(szC,&c); // will start at address of c and move until it hits a '\0'
- >in memory somewhere
-
- >That will most likely step on the stack. By throwing in a cout << you are
- >pushing the stack around. If you really need to do the above try.
-
- >char c[2];
- >c[1] = '\0';
- >.
- >other code
- >.
- >*c = *ptr;
- >strcat(sz, c);
-
- Hi, Jeff:
-
- 1.This way program still doesn't work right. But that's because of my
- bad algorithm not becouse of your correction.
-
- 2. You do gave me a clue. After I have initialized char c='\0',
- program started to work properly. So, thank you very much.
- There are still some problems with precision but in general it works.
-
- Thanks again,
-
- Pavel
-
-